import os
import sqlite3

def DBInit(db_path):
    if not os.path.exists(db_path):
        conn=sqlite3.connect(db_path)
        c=conn.cursor()
        
        c.execute("create table users(id integer primary key autoincrement,name,password)")
        c.execute("insert into users(name,password) values ('test1','test1')")
        c.execute("insert into users(name,password) values ('test2','test2')")
        c.execute('''CREATE TABLE record(
date primary key,
name,
salary,
rctime)''')
        test_record=('1999-07-15','test',0,'2016-08-14 17:06')
        c.execute("INSERT INTO record VALUES(?,?,?,?)",test_record)

        conn.commit()
        c.close()
        conn.close()
        
        
if __name__=="__main__":
    db_path='test.db'
    DBInit(db_path)
